USE [xRepair]
GO

/****** Object:  StoredProcedure [dbo].[AddNewModel]    Script Date: 2/23/2014 12:13:21 AM ******/
DROP PROCEDURE [dbo].[AddNewModel]
GO

/****** Object:  StoredProcedure [dbo].[AddNewModel]    Script Date: 2/23/2014 12:13:21 AM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[AddNewModel]
		 @BrandID				INT
		,@ModelName				NVARCHAR(200)
		,@Version				NVARCHAR(50)
		,@Manufacturer			NVARCHAR(500)
		,@CreatedAt				DATETIME = NULL
		,@CreatedBy				NVARCHAR(50) = NULL		
		,@NewIdentity			INT = NULL OUTPUT
AS
BEGIN

	SET NOCOUNT ON;
	
	INSERT INTO [dbo].[Model]
           ([BrandID]
		   ,[ModelName]
           ,[Version]
           ,[Manufacturer]
           ,[IsActive]
           ,[CreatedAt]
           ,[CreatedBy])
     VALUES
           (@BrandID
		   ,@ModelName
           ,@Version
           ,@Manufacturer
           ,1
           ,@CreatedAt
           ,@CreatedBy)

	SELECT @NewIdentity = @@IDENTITY

END



GO


